<?php

/**
 * CampaignComment form.
 *
 * @package    cuv
 * @subpackage form
 * @author     Your name here
 */
class CampaignCommentForm extends BaseCampaignCommentForm
{
  protected $campaign;

  public function  __construct(Campaign $campaign, $object = null, $options = array(), $CSRFSecret = null)
  {
    $this->campaign = $campaign;
    parent::__construct($object, $options, $CSRFSecret);
  }

  public function configure()
  {
    unset(
      $this['id_campaign'],
      $this['created_at'],
      $this['updated_at'],
      $this['deleted_at'],
      $this['is_published']
    );
    
    $this->validatorSchema['email'] = new sfValidatorEmail();

    $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array(
      'public_key' => '6LcUvb8SAAAAACH7jqkjLEsPUcYPcNXcHfH760KV '
    ));
    
    $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array(
      'private_key' => '6LcUvb8SAAAAAKrYpT6ueOaUkILzyyHz2nbQpxWj '
    ));

  }

  public function doSave($con = null)
  {
    $this->getObject()->setIdcampaign($this->campaign->getId());
    parent::doSave();
  }
}
